<include file="public@head_top"/>
<include file="public@member_top"/>
</head>
<body class="bgeee">
<include file="public@head"/>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>
<script type="text/html" id="files-item-tpl">
    <li id="saved-file{id}">
        <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
        <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
               style="width: 200px;" title="文件名称">
        <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
        <a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
        <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
    </li>
</script>
<style>
.form-required {
	color: red;
}
.uploadcontent .upload a,.uploadcontent .upload a input{ width:150px!important;}
</style>

<div class="wrap clearfloat tc-main">
	<div class="row">
    
        <div class="col-lg-3 leftnav">
            <include file="public@usernav" />
        </div>
        
		<div class="col-lg-9 rightmain">

                <div class="card-header usertitle">
                    <ul class="nav nav-tabs card-header-tabs">
                      <li class="nav-item">
                        <a class="nav-link" href="{:cmf_url('portal/list/index',array('id'=>$configinfo['moduleid']))}?act=supplier&type=list"><i class="fa fa-list-ul"></i> 数据列表</a>
                      </li>
                      <li class="nav-item">
                        <a class="nav-link active" href="#one" data-toggle="tab"><i class="fa fa-edit"></i> 编辑数据</a>
                      </li>
                    </ul>
                  </div>
                  
                <div class="tab-content usercontent articleContentBlock">
                    <div class="tab-pane active" id="one">
                    
                        <form class="js-ajax-form" action="{:cmf_url('portal/list/index',array('id'=>$configinfo['moduleid']))}?act=supplier&type=editpost" method="post">
                            <div class="form-group row">
                                <label for="input-category_id" class="col-12 col-sm-2 col-form-label"><span class="form-required">*</span>分类</label>
                                <div class="col-12 col-sm-7 listbox">
                                    <select class="form-control" name="category_id" required id="input-category_id">
                                        <option value="{$configinfo['moduleid']}">{$configinfo['moduleinfo']['name']}</option>
                                        {$categories_tree}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="input-post_title" class="col-12 col-sm-2 col-form-label"><span class="form-required">*</span>标题</label>
                                <div class="col-12 col-sm-7 listbox"><input type="text" required class="form-control" id="input-post_title" name="senddata[post_title]" value="{$data.post_title}"></div>
                            </div>
                            <div class="form-group row">
                                <label for="input-post_keywords" class="col-12 col-sm-2 col-form-label">主图</label>
                                <div class="col-12 col-sm-9 listbox">
                                    <input type="hidden" name="senddata[more][thumbnail]" id="thumbnail"
                                           value="{$data.more.thumbnail|default=''}">
                                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                        <if condition="empty($data.more.thumbnail)">
                                            <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                 id="thumbnail-preview"
                                                 width="135" style="cursor: pointer"/>
                                            <else/>
                                            <img src="{:cmf_get_image_preview_url($data.more.thumbnail)}"
                                                 id="thumbnail-preview"
                                                 width="135" style="cursor: pointer"/>
                                        </if>
                                    </a>
                                    <input type="button" class="btn btn-danger btn-sm btn-cancel-thumbnail st-mart50" value="取消图片">
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="input-post_keywords" class="col-12 col-sm-2 col-form-label">关键词</label>
                                <div class="col-12 col-sm-7 listbox">
                                    <input type="text" class="form-control" id="input-post_keywords" name="senddata[post_keywords]" value="{$data.post_keywords}" placeholder="请输入关键字">
                                    <p class="help-block">多关键词之间用英文逗号隔开</p>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="input-post_excerpt" class="col-12 col-sm-2 col-form-label">摘要</label>
                                <div class="col-12 col-sm-9 listbox">
                                	<textarea class="form-control" id="input-post_excerpt" name="senddata[post_excerpt]" style="height: 80px;" placeholder="请填写摘要">{$data.post_excerpt}</textarea>
                                </div>
                            </div>
                            {$contenthtml}
                            <div class="form-group row">
                                <label for="input-post_excerpt" class="col-12 col-sm-2 col-form-label">内容</label>
                                <div class="col-12 col-sm-9 listbox">
                                	<script type="text/plain" id="content" name="senddata[post_content]" style="height:350px;">{$data['post_content']}</script>
                                </div>
                            </div>
                            <div class="form-group row listButBox">
                            	<label for="input-post_excerpt" class="col-12 col-sm-2 col-form-label"></label>
                                <div class="col-12 col-sm-9 listbox">
                                    <input type="hidden" value="{$_MGPC_GET['actid']}" name="actid">
                                    <button type="submit" class="btn btn-success js-ajax-submit">确定保存</button>
                                </div>
                            </div>
                        </form>
                        
                    </div>
                </div>
                
        </div>
        
    </div>
</div>
<!-- /container -->

<script type="text/javascript" src="/static/js/ueditor/ueditor.frontend.config.js"></script>
<script type="text/javascript" src="/static/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    var editorURL = GV.WEB_ROOT;
    var editor    = new baidu.editor.ui.Editor();
    editor.render("content");
</script>
<script>
$(function () {
	$('.btn-cancel-thumbnail').click(function () {
		$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
		$('#thumbnail').val('');
	});
});
</script>

<include file="public@footer"/>
<include file="public@member_scripts"/>
</body>    
</html>